﻿using CTS.Com.Resources.Strings;

namespace CTS.Com.Domain.Helper
{
    /// <summary>
    /// FormatHelper
    /// </summary>
    public static class FormatHelper
    {
        /// <summary>
        /// Lấy chuỗi format từ resource.
        /// </summary>
        /// <param name="formatId">Mã format</param>
        /// <returns>Chuỗi format</returns>
        public static string GetFormatString(string formatId)
        {
            // Local variable declaration
            var strNm = string.Empty;
            // Get string external
            var rms = ContextHelper.FormatResources;
            for (int i = rms.Count - 1; i >= 0; i--) {
                var rm = rms[i];
                strNm = rm.GetString(formatId);
                if (strNm != null) {
                    return strNm;
                }
            }
            // Get string internal
            strNm = Formats.ResourceManager.GetString(formatId);
            // Return value
            return strNm;
        }
    }
}
